﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Announcement_AnnouncementPage : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    if (!IsPostBack)
    {
      if (Request["bid"] != null)
      {
        lbl_BULLETIN_ID.Text = Request["bid"];
        KRJEntities dc = new KRJEntities();
        var CUR_BULLETIN_MASTER = dc.KRJ_BULLETIN_MASTER
           .Where(b => b.BULLETIN_ID == lbl_BULLETIN_ID.Text)
           .FirstOrDefault();
        if (CUR_BULLETIN_MASTER != null)
        {
          lbl_START_DATE.Text = CUR_BULLETIN_MASTER.START_DATE;
          lbl_END_DATE.Text = CUR_BULLETIN_MASTER.END_DATE;

          string language =
            Request.Cookies["KerryLang"] != null ? Request.Cookies["KerryLang"].Values["Language"].ToString() : "zh-TW";
          switch (language)
          {
            case "zh-TW":
              lbl_BULLETIN_TEXT.Text = CUR_BULLETIN_MASTER.BULLETIN_TEXT_TW;
              lbl_BULLETIN_SPEC.Text = CUR_BULLETIN_MASTER.BULLETIN_SPEC_TW;
              break;
            case "zh-CN":
              lbl_BULLETIN_TEXT.Text = CUR_BULLETIN_MASTER.BULLETIN_TEXT_GB;
              lbl_BULLETIN_SPEC.Text = CUR_BULLETIN_MASTER.BULLETIN_SPEC_GB;
              break;
            case "en-US":
              lbl_BULLETIN_TEXT.Text = CUR_BULLETIN_MASTER.BULLETIN_TEXT_EN;
              lbl_BULLETIN_SPEC.Text = CUR_BULLETIN_MASTER.BULLETIN_SPEC_EN;
              break;
          }
        }
        FileUtil.DisplayAttachmentFiles(PlaceHolder_Files, lbl_BULLETIN_ID.Text);
      }

    }
  }



  protected void btn_Exit_Click(object sender, EventArgs e)
  {
    Response.Redirect("~/Default.aspx");
  }
}